/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-08-04
 * Time:20:46
 */
import java.lang.String;
 class Student implements Comparable<Student>{
    public String name;
    public int age;
    public Student(String name,int age) {
        this.name = name;
        this.age=age;
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    public int compareTo(Student o){
       if (this.age>o.age){
           return 1;
       }else if(this.age==o.age){
           return 0;
       }else{
           return -1;
       }
       //return this.age-o.age;
    }
}
public class Test1 {
    public static void main(String[] args) {
        Student student1 = new Student("小红", 10);
        Student student2 = new Student("小明", 11);
        System.out.println(student1.compareTo(student2));
    }
}